package designpattern.factorial;

import java.math.BigInteger;

public class BigIntegerHandler implements Handler {
    Handler next;

    @Override
    public void setNext(Handler handler) {
        next = handler;

    }

    @Override
    public void handleRequest(int n) {
        BigInteger result = new BigInteger("1");
        for (int i = 2; i <= n; i++)
            result = result.multiply(new BigInteger(Integer.toString(i)));
        System.out.println(String.format("%d!=%s", n, result));

    }

}
